package com.example.demo.exception

/**
 * 异常处理方0法
 */
class ThrowUtil {

    fun throwIf(condition: Boolean,runtimeException: RuntimeException){
        if (condition){
            throw runtimeException
        }
    }
    fun throwIf(condition: Boolean,errorCode: ErrorCode){
        throwIf(condition, BusinessException(errorCode))
    }
    fun throwIf(condition: Boolean, errorCode: ErrorCode, msg: String){
        throwIf(condition, BusinessException(errorCode, msg))
    }
}